﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using System.Collections.Generic;
using HZ.DrugTrade.Web;
using HZ.DrugTrade.Model;
using HZ.DrugTrade.Model.Enum;
using HZ.DrugTrade.IBLL;
using HZ.DrugTrade.BLLFactory;

using HZ.Common;


namespace HZ.DrugTrade.Web.Hospitals.Collection
{
    public partial class CompanySelect : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SetBind();
            }
        }

        protected void btnQuery_Click(object sender, EventArgs e)
        {
            AspNetPager1.CurrentPageIndex = 1;
            SetBind();
        }

        private void SetBind()
        {

            try
            {
                string companyName = "";
                AspNetPager1.PageSize = 10;
                int totalRecord = 0;
                IBLL_Purchase iPurchase = Factory.BLL_Purchase();
                IList<Company> lstcompany = iPurchase.GetUnPayCompanyList(CurrentAccount.GetUser().Org.OrgID, companyName, AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex, out totalRecord);
                AspNetPager1.RecordCount = totalRecord;
                gvwGoodsInfo.DataSource = lstcompany;
                gvwGoodsInfo.DataBind();
            }
            catch (Exception ex)
            {
                PageError(ex.Message, "");
            }

        }

        protected void AspNetPager1_OnPageChanged(object sender, EventArgs e)
        {
            SetBind();
        }

    }
}
